﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ZhaGanSharp.Windows
{
    /// <summary>
    /// TopmostTooltip.xaml 的交互逻辑
    /// </summary>
    public partial class TopmostTooltip : Window
    {
        private System.Timers.Timer AutoCloseThis = new System.Timers.Timer(3500);
        public TopmostTooltip()
        {
            InitializeComponent();
            AutoCloseThis.Elapsed+= new System.Timers.ElapsedEventHandler(AutoCloseThis_DoWork);
            AutoCloseThis.Start();
        }
        private void AutoCloseThis_DoWork(Object sender,System.Timers.ElapsedEventArgs e){
            AutoCloseThis.Stop(); AutoCloseThis.Elapsed -= new System.Timers.ElapsedEventHandler(AutoCloseThis_DoWork); AutoCloseThis.Dispose();
            this.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(delegate{
                    this.Close();
                })
            );
        }

    }
}
